package com.hzqy.persistence.dao.itf;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.hzqy.persistence.dao.core.PersistenceDao;
import com.hzqy.web.vo.CmContentVo;
import com.hzqy.web.vo.PmsAttributeVo;
import com.hzqy.web.vo.PmsOrgVo;
import com.hzqy.web.vo.PmsResourceVo;
import com.hzqy.web.vo.PmsUserVo;

@Repository
public class LoginDao extends PersistenceDao<CmContentVo, Integer>{

	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	
	public PmsOrgVo selectOrgByName(String f_po_name){
		return getSqlSession().selectOne(this.getNamespace() + "selectOrgByName", f_po_name);
	}
	
	public PmsUserVo findUser(PmsUserVo puv) {
		return getSqlSession().selectOne(this.getNamespace() + "findUser", puv);
	}
	
	public List<PmsAttributeVo> selectUserAttributeList(String roleIds) {
		String namespace = this.getNamespace();
		return getSqlSession().selectList(namespace + "selectUserAttributeList",roleIds); 
	}
	
	public List<PmsResourceVo> selectUserResourceList(String roleIds) {
		String namespace = this.getNamespace();
		return getSqlSession().selectList(namespace + "selectUserResourceList",roleIds); 
	}

	public PmsUserVo selectClickLoginUser(int f_po_id, String prefix) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("f_po_id", f_po_id);
		params.put("prefix", prefix);
		return getSqlSession().selectOne(this.getNamespace() + "selectClickLoginUser",params); 
	}
	
}
